<?php

final class Login_Model extends Model {

	public function __construct($file) {
		parent::__construct($file);
	}
	
	public function processar() {
		$login = $_POST['login'];
		$senha = $_POST['senha'];
		$rs = $this->db->query("SELECT * FROM usuarios WHERE login='$login' AND senha='$senha'");
		$rs->execute();
		$count = $rs->rowCount();
		if($count > 0) {
			//login
			Session::init();
			Session::set('loggedIn',true);
			header('location: '.URL.'admin');
		} else {
			//mostra um erro	
			header('location: '.URL.'login');
		}
 	}
		
}